home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / robot_alien_scripts.lua < prev    next >
Encoding:
Text File  |  2006-08-31  |  7.0 KB  |  187 lines

  1. function units_robot_alien_setup()
  2.     units_setup(7,true,ENET_EFFECT_PS_SETUPSMOKE_LARGE,ENET_EFFECT_GEOMETRY_ROBOTALIENSHADOW)
  3.     units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ALIENROBOTROCKET)
  4. end
  5.  
  6. function units_robot_alien_resetup()
  7.     units_setup(7,true,nil,ENET_EFFECT_GEOMETRY_ROBOTALIENSHADOW)
  8.     units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ALIENROBOTROCKET)
  9. end
  10.  
  11. function units_robot_alien_select()
  12.     units_select(22,2)
  13. end
  14.  
  15. function units_robot_alien_unselect()
  16.     units_unselect()
  17. end
  18.  
  19. function units_robot_alien_selectenemy()
  20.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  21. end
  22.  
  23. function units_robot_alien_damaged()
  24.     uniGetExecutor():applyDamage(uniGetLife())
  25. end
  26.  
  27. function units_robot_alien_highlight()
  28.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  29. end
  30.  
  31. function units_robot_alien_explode()
  32.     --units_explode_big()
  33.     units_explode_big1()
  34. end
  35.  
  36. function units_robot_alien_move()
  37.     local unit = uniGetExecutor()
  38.     local steps = {}
  39.     local i = 0;
  40.     steps[0] = unit:getBone(ENBT_STEPEMITTER,0):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_ROBOTALIENSTEPSEMITTER_LEFT)
  41.     steps[1] = unit:getBone(ENBT_STEPEMITTER,1):addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_ROBOTALIENSTEPSEMITTER_RIGHT)
  42.     local sound = unit:play3DSound("robot_alien_rotate.wav",1)
  43.     unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  44.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7))
  45.     unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
  46.     unit:setCurrentAnimationRepeatCount(0)
  47.     for i = 0,1 do
  48.         steps[i+2] = unit:getBone(ENBT_STEPEMITTER,i):addSimpleEffect(ENET_EFFECT_PS_TRACKSMOKE)
  49.     end
  50.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,120))
  51.     unit:setCurrentAnimationRepeatCount(0)
  52.     sound:destroy()
  53.     unit:play3DSound("robot_alien_stop.wav",0):destroy()
  54.     for i = 0,1 do
  55.         if(unit:getScale() < 1.0) then 
  56.             steps[i]:destroy()
  57.         else
  58.             steps[i]:setTransformOwner()
  59.             steps[i]:suspendedDestroy(70)
  60.         end
  61.         steps[i+2]:suspendedDestroy(1.0)
  62.     end
  63. end
  64.  
  65. function units_robot_alien_fire1()
  66.     local unit = uniGetExecutor()
  67.     uniSetLife(uniGetLife() / 8.0)
  68.     local sound = unit:play3DSound("robot_alien_rotate.wav",1)
  69.     unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  70.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7,uniGetTarget()))
  71.     unit:setCurrentAnimationRepeatCount(0)
  72.     sound:destroy()
  73.     local gn = unit:getBone(ENBT_TARGET)
  74.     waitDeath(gn:getBone(ENBT_GUN):addRotationEffect(ENET_EFFECT_ROTATE_GUNTOTARGET,MATH_PI / 3.0,uniGetTarget()))
  75.     local firespots = {}
  76.     firespots[0] = gn:getBone(ENBT_FIRE1,0)
  77.     firespots[1] = gn:getBone(ENBT_FIRE1,1)
  78.     local i
  79.     for i = 0,3 do
  80.         unit:play3DSound("robot_alien_fire.wav",0):destroy()
  81.         firespots[0]:addBulletEffect(ENET_EFFECT_BULLET_ENERGYSTAR):executeCommand(ENC_FIRE1)
  82.         pause(0.1)
  83.         unit:play3DSound("robot_alien_fire.wav",0):destroy()
  84.         firespots[1]:addBulletEffect(ENET_EFFECT_BULLET_ENERGYSTAR):executeCommand(ENC_FIRE1)
  85.         pause(0.1)
  86.     end
  87.     unit:addFireArrow()
  88. end
  89.  
  90. function units_robot_alien_fire2()
  91.     local unit = uniGetExecutor()
  92.     uniSetLife(uniGetLife() / 2.0)
  93.     local sound = unit:play3DSound("robot_alien_rotate.wav",1)
  94.     unit:addAnimationToQueue(ENAT_TURNING,MATH_INFINITY)
  95.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNIT,MATH_PI * 0.7,uniGetTarget()))
  96.     unit:setCurrentAnimationRepeatCount(0)
  97. --    unit:resetAnimations()
  98.     sound:destroy()
  99.     local f_pause = 0.35
  100.     unit:getBone(ENBT_FIRE2,0):findEffect(ENET_EFFECT_BULLET_ALIENROBOTROCKET):executeCommand(ENC_FIRE1)
  101.     pause(f_pause)
  102.     unit:getBone(ENBT_FIRE2,1):findEffect(ENET_EFFECT_BULLET_ALIENROBOTROCKET):executeCommand(ENC_FIRE1)
  103.     pause(1.0)
  104.     units_reloadfirespots(uniGetExecutor(),2,ENET_EFFECT_BULLET_ALIENROBOTROCKET)
  105.     unit:addFireArrow()
  106. end
  107.  
  108. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_MOVE,"units_robot_alien_move")
  109. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_FIRE1,"units_robot_alien_fire1")
  110. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_FIRE2,"units_robot_alien_fire2")
  111. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_SELECT,"units_robot_alien_select")
  112. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_SELECTENEMY,"units_robot_alien_selectenemy")
  113. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_UNSELECT,"units_robot_alien_unselect")
  114. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_SETUP,"units_robot_alien_setup")
  115. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_RESETUP,"units_robot_alien_resetup")
  116. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_DAMAGED,"units_robot_alien_damaged")
  117. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_EXPLODE,"units_robot_alien_explode")
  118. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_HIGHLIGHT,"units_robot_alien_highlight")
  119. registerCommand(ENSCRIPTSET_ROBOT_ALIEN,ENC_INSIDE,"units_inside")
  120.  
  121. -- make description of unit
  122. desc = getEffectDescriptionP(ENET_UNIT_ROBOT_ALIEN)
  123. desc.ClassID = ENCLASS_MESHINSTANCE
  124. desc.EffectClassType = ENECT_GEOMETRY
  125. desc.FileName = "robot_alien.rmd"
  126. desc.ScriptSet = ENSCRIPTSET_ROBOT_ALIEN
  127. desc.MoveType = ENMOVE_GROUND
  128. desc.RenderType = ENRENDERTYPE_GEOMETRY
  129. desc.Material = ENMAT_RIGIDSKINNEDMESH
  130. desc.MaterialColors = units_materialcolors_human
  131.  
  132. -- shadow
  133. desc = getEffectDescriptionP(ENET_EFFECT_GEOMETRY_ROBOTALIENSHADOW)
  134. desc.ClassID = ENCLASS_MESHINSTANCE
  135. desc.EffectClassType = ENECT_GEOMETRY
  136. desc.FileName = "robot_alien_shadow.rmd"
  137. desc.RenderType = ENRENDERTYPE_SHADOW
  138. desc.Material = ENMAT_SHADOW
  139. desc.MaterialColors = units_materialcolors_shadow
  140.  
  141. -- register new unit to logic
  142. unitDesc = logic_getUnitDescP(14)
  143. unitDesc.group = 0
  144. unitDesc.order = 3
  145. unitDesc.unit_res_id = ENET_UNIT_ROBOT_ALIEN
  146. unitDesc.unit_icon_id = "Robot_a_small_normal.dds"
  147. unitDesc.active_id = "Robot_a_small_active.dds"
  148. unitDesc.pressed_id = "Robot_a_small_pressed.dds"
  149. unitDesc.big_icon_id = "Robot_a_big_normal.dds"
  150. unitDesc.small_icon_id = "Robot_l_stats.dds"
  151. unitDesc.HP = 7
  152. unitDesc.MP = 20
  153. unitDesc.WR = 2
  154. unitDesc.min_WR = 1
  155. unitDesc.WD = 3
  156. unitDesc.WR2 = 0
  157. unitDesc.min_WR2 = 0
  158. unitDesc.WD2 = 0
  159. unitDesc.ability = 1
  160. unitDesc.transport = 0
  161. unitDesc.value = 4
  162. unitDesc.race = 1
  163. unitDesc.fire_pause = 0.6
  164. unitDesc.move_pause = 0.7
  165. unitDesc.unit_info_scale = 0.07
  166. unitDesc.scn_name = "HBOTA"
  167.  
  168. ------------------------------------------------------------------------------------------------------
  169. ------------------------ effects related to unit------------------------------------------------------
  170. ------------------------------------------------------------------------------------------------------
  171.  
  172. function bullets_energystar_fire()
  173.     local bullet = uniGetExecutor()
  174.     bullet:setTransformOwner()
  175.     local light = bullet:addSimpleEffect(ENET_EFFECT_LIGHT_ENERGYSTARFLY)
  176.     local track = bullet:addSimpleEffect(ENET_EFFECT_PS_ENERGYSTARFLY)
  177.     waitDeath(bullet:addMoveEffect(ENET_EFFECT_MOVE_LINEARFLY,250,uniGetTarget()),1000)
  178.     light:destroy()
  179.     track:destroy()
  180.     bullet:addSimpleEffect(ENET_EFFECT_PS_ENERGYSTARHIT):suspendedDestroy(1.0)
  181.     uniGetTarget():executeCommand(ENC_DAMAGED)
  182.     pause(1.0)
  183.     bullet:destroy()
  184. end
  185.  
  186. registerCommand(ENSCRIPTSET_BULLET_ENERGYSTAR,ENC_FIRE1,"bullets_energystar_fire")
  187.